<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    function formate(url,data){
        //判断
        var type ="GET";
        if(arguments.length === 1){
        
            type ="POST";
            data =url;
            url ="";
        }
        //拼接：
        var start =true;
        for(var key in date){
            if(type === "GET"){
                url += (start ? "?":"%") 
            }else if(type === "POST"){
                              url += (start ? "" : "&") + key + "=" + data[key];
                        }
                        start = false;
                  }
                  return url;
            }
</script>